import React, {Component} from 'react';
import SplashScreen from 'react-native-splash-screen';
import store from './redux/store';
import {
  StyleSheet,
  Text,
  View,
  Image,
  Dimensions,
  TouchableOpacity,
} from 'react-native';

const { width, height } = Dimensions.get('window');
const state = store.getState();

export default class Home extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {
    SplashScreen.hide();
    console.log('state');
    console.log(state);
  }

  render() {
    return (
      <View style={styles.container}>
        <Text>Home</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

// 发送一条数据
/* const action = {
  type: 'login_info',
  payload: 'Learn Redux'
}; */

//发送多条数据
const ADD_TODO = 'login_info';

function addTodo(text) {
  return {
    type: ADD_TODO,
    payload: text
  }
}

console.log('action, 啦啦啦啦');
store.dispatch(addTodo('Learn Redux'));